package com.only4play.practice.common.enums.pay;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.only4play.codegen.support.constants.BaseEnum;

import java.util.Optional;

/**
 * 签名验签类型
 * @author mengdy
 */
public enum PayChannelSignType implements BaseEnum<PayChannelSignType>{

    HMAC_SHA256(1, "HMAC_SHA256"),
    MD5(2, "MD5"),
    SM3(3, "SM3"),

        ;

    PayChannelSignType(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        @EnumValue
        private Integer code;
        private String name;

        @Override
        public Integer getCode() {
            return this.code;
        }

        @Override
        public String getName() {
            return this.name;
        }

        public static Optional<PayChannelSignType> of(Integer code) {
            return Optional.ofNullable(BaseEnum.parseByCode(PayChannelSignType.class, code));
        }

}
